﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Remofi
{
    public enum ActionType
    {
        UP,
        DOWN
    }
    public class PPTAction
    {
        public static void ControlPPT(ActionType at)
        {
            IntPtr calculatorHandle = FindWindow("PPTFrameClass", null); //find the PPT window
            if (calculatorHandle == IntPtr.Zero)
            {
                MessageBox.Show("PPT is not running.");
            }
            else
            {
                SetForegroundWindow(calculatorHandle);
                //simulate the 'down' key
                SendKeys.SendWait("{" + at.ToString() + "}");
            }
        }

        //Native Windows API to find the PowerPoint window
        [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
        private static extern IntPtr FindWindow(string lpClassName,
            string lpWindowName);


        [DllImport("USER32.DLL")]
        private static extern bool SetForegroundWindow(IntPtr hWnd);
    }

    

}
